package com.tech.cloud.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Swagger3Config {

    @Bean
    public GroupedOpenApi PayApi() {
        return GroupedOpenApi.builder().group("支付微服务模块")
                .pathsToMatch("/pay/**").build();
    }

    @Bean
    public GroupedOpenApi OtherApi() {
        return GroupedOpenApi.builder().group("其他微服务模块")
                .pathsToMatch("/other/**", "others").build();
    }


    @Bean
    public OpenAPI docsOpenApi() {
        return new OpenAPI()
                .info(new Info().title("cloud_tech")
                        .description("通用架构设计")
                        .version("v1.0"))
                .externalDocs(new ExternalDocumentation()
                        .description("整合目前微服务最新组件，基于jdk17、spring boot3.2.0")
                        .url("www.baidu.com"));
    }

}
